<?php

namespace app\admin\controller;

use app\admin\middleware\CategoryAdmin;
use app\BaseController;
use think\facade\Session;

class Base extends BaseController
{
    protected $uid;
    protected $role;
    protected $middleware = [CategoryAdmin::class];
    public function __construct()
    {
        if (!Session::has('admin')) {
            exit("<script>alert('请登录再来操作');window.location.href='/admin/login'</script>");
        }
        $this->uid = Session::get('admin.id') ?? 0;
        $this->role = Session::get('admin.role') ?? 1;
    }
}
